from django.contrib import admin
from apps.shiyanshi.model import LaboratoryMember, User, PublishBlog, Groups, Subject


@admin.register(LaboratoryMember)
class LaboratoryMemberAdmin(admin.ModelAdmin):
    list_display = ['true_name', 'school_number', 'year']


@admin.register(User)
class UserAdmin(admin.ModelAdmin):
     list_display = ['username', 'password', 'qq_number', 'about_me', 'information']


@admin.register(PublishBlog)
class PublishBlogAdmin(admin.ModelAdmin):
    list_display = ['title', 'context', 'author', 'time', 'group_id', 'subject_id']

    '''def group(self, obj):
        group_obj = Groups.objects.get(group_id=obj)
        return group_obj.group_name

    def subject(self, obj):
        subject_obj = Subject.objects.get(subject_id=obj)
        return subject_obj.subject_name'''


@admin.register(Groups)
class GroupsAdmin(admin.ModelAdmin):
     list_display = ['group_id', 'group_name']


@admin.register(Subject)
class SubjectAdmin(admin.ModelAdmin):
     list_display = ['subject_id', 'subject_name']
